package com.issoft.studentresitor.mapper;

import com.issoft.studentresitor.domain.pojo.Fee;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.issoft.studentresitor.domain.query.FeeQuery;
import com.issoft.studentresitor.domain.vo.FeeVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author GJH
 * @since 2025-09-14
 */
public interface FeeMapper extends BaseMapper<Fee> {
    /**
     * 分页查询缴费记录（关联学生、专业、班级信息）
     */
    List<FeeVo> queryFeePage(FeeQuery feeQuery);
    /**
     * 根据学生ID查询缴费记录
     */
    List<FeeVo> queryFeeByStudentId(@Param("studentId") String studentId);
    /**
     * 更新缴费状态
     */
    @Update("UPDATE fee SET payment_status = #{paymentStatus}, payment_method = #{paymentMethod}, " +
            "payment_date = NOW() WHERE fee_id = #{feeId}")
    int updatePaymentStatus(@Param("feeId") Integer feeId,
                            @Param("paymentStatus") String paymentStatus,
                            @Param("paymentMethod") String paymentMethod);
    /**
     * 获取缴费统计信息
     */

    FeeVo getFeeStatistics();
    /**
     * 根据用户ID查询缴费记录
     */
    List<Fee> queryByUserId(Integer userId);
}
